package com.doit.day06

object _04_特质 {
  def main(args: Array[String]): Unit = {

    //上面这个鸟是正常的鸟
    val bird: Bird = new Bird
    //特质的动态混入
    //这个喝了核污水的鸟可不是一般的鸟   可以孵化龙
    val bird1: Bird with CanBirthLong = new Bird with CanBirthLong {
      override def birth(): Unit = println("可以孵化龙")
    }

  }

}


//java中继承 extends   特质用的是 extends   既有父类，又有特质  with
class Bird() extends CanFly  {
  override val name: String = "小小鸟"

  override def canFly(): Unit = println("老子会飞")
}